/* 
 * File:   lcd.h
 * Author: aeon
 *
 * Created on January 16, 2013, 1:50 PM
 */

#ifndef LCD_H
#define	LCD_H

    void lcd_send_cmd(unsigned char);
    /* Description: sends lcd commands
     * Parameters (in order): None
     * Returns: None
     * Requires: lcd_init()
     * Example : lcd_send_cmd(0x01) // this clears the lcd
     * Other Information:
     * below is a list of all lcd commands that could be send to a 16 x 2 LCD
     * Note: all commands are to be send as they appear below, do not swap high and low nibble
     * Clear LCD = 0x01
     * Display OFF Cursor OFF = 0x08
     * Display ON Cursor ON = 0x0E
     * Display ON Cursor OFF = 0x0C
     * Display ON Cursor Blinking = 0x0F
     * Shift entire display left = 0x18
     * Shift entire display right = 0x1C
     * Move cursor left by one character = 0x10
     * Move cursor right by one character = 0x14 */

    void lcd_send_char(unsigned char);
    /* Description: send a single UNSIGNED character to the lcd
     * Parameters (in order): unsigned character
     * Returns: None
     * Requires: lcd_init();
     * Example: lcd_send_chr('s') //this send the ascii character 's' to the LCD
     * Other Information:None*/


    void lcd_send_txt(const unsigned char * p);
    /* Description: send a string to the lcd
     * Parameters (in order): character pointer
     * Returns: None
     * Requires: lcd_init();
     * Example: lcd_send_chr("yap") //this prints "yap" at the current position on the LCD
     * Other Information: it doesnot check if the characters over flow the line limit */

    void lcd_clear(void);
    /* Description: clears the lcd module
     * Parameters (in order): None
     * Returns: None
     * Requires: None
     * Example: lcd_clear() //this clears the lcd
     * Other Information: it does not bring the cursor to the 1,1 position */

    void init_lcd(void);
    /* Description: This command Initializes the LCD in 4Bit - Cursor Blinking mode.
     * Parameters (in order): None
     * Returns: None
     * Requires: None
     * Example: init_lcd()
     * Other Information: Note this function sets  */

    void lcd_change_line(void);
    /* Description: This function bring the cursor on second line of a 16x2 lcd
     * Parameters (in order): None
     * Returns: None
     * Requires: init_lcd()
     * Example: line_change();
     * Other Information:  None*/

    void lcd_send_char_xy(unsigned int x, unsigned int y, unsigned char s );
    /* Description: this function prints a character at a given x,y position
     * Parameters (in order): x - horizontal cell number
     *                        y - vertical cell number
     *                        s - the character to be printed
     * Returns: None
     * Requires: init_lcd()
     * Example: lcd_send_char_xy(15,1,'a') // this prints the character 'a' at the bottom right corner of the lcd;
     * Other Information:  top left corner of the lcd is 0,0 it goes upto 15 in horizontal direction and upto 1 in vertical direction */

    void lcd_send_txt_xy(unsigned int x, unsigned int y, unsigned char *p );
    /* Description: this function prints a text at a given x,y position
     * Parameters (in order): x - horizontal cell number
     *                        y - vertical cell number
     *                        s - pointer to the character array to be printed
     * Returns: None
     * Requires: init_lcd()
     * Example: lcd_send_txt_xy(15,1,'apple') // this prints the string 'apple' at the bottom right corner of the lcd;
     * Other Information:  top left corner of the lcd is 0,0 it goes upto 15 in horizontal direction and upto 1 in vertical direction */

    void lcd_move_cursor(unsigned int x, unsigned int y);
    /* Description: this function moves the cursor to the passed x,y position
     * Parameters (in order): x - horizontal cell number
     *                        y - vertical cell number
     * Returns: None
     * Requires: init_lcd()
     * Example: lcd_move_cursor(7,0,'apple') // moves the cursor to the middle of first line
     * Other Information:  top left corner of the lcd is 0,0 it goes upto 15 in horizontal direction and upto 1 in vertical direction */

#endif	/* LCD_H */

